package List;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;

/**
 * @author yangwenqi
 * @decs TODO
 * @date 2025/4/28
 * 将字符串中的数值 String str="9 10 12  6  8 15"; 进行排序
 */

public class Sort {
    public static void main(String[] args) {
        String str="9 10 12  6  8 15";
        String[] strs=str.split("\\s+");
//        System.out.println(strs);
//        List<String> list = Arrays.asList();

        Arrays.sort(strs,new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return Integer.parseInt(o1) - Integer.parseInt(o2);
            }
        });
        System.out.println(Arrays.toString(strs));
    }
}

